<?php
require_once('lib/dbclass.php');
$db = new MySQL();


if (! $db->Query("select * from agenda
	order by id_agenda desc")) $db->Kill(); 
?>


<h2>Admin Agenda</h2>

<div class="tabeledit">
<table border="0" width="100%">
	<tr>
	<th width="5%" bgcolor="#494949"><p color="white">No</p></th>
	<th width="45%" bgcolor="#494949"><p>Keterangan</p></th>
	<th width="33%" bgcolor="#494949"><p>Tempat</p></th>
	<th width="32%" bgcolor="#494949"><p>Aksi</p></th>
	</tr>
	<?php $no=1;?>
	<?php while($rs = $db->RowArray()):?>
	<tr>
	<td align="center"><?php echo $no?></td>
	<td align="left"><?php echo $rs['isi']?></td>
	<td align="left"><?php echo $rs['tempat']?></td>
	<td><a class="btn btn-default btn-sm" href="index.php?q=12&id=<?php echo $rs['id_agenda'];?>"><i class="fa fa-cog"></i> Settings</a>
		<a class="btn btn-danger" href="hapus_agenda.php?id=<?php echo $rs['id_agenda'];?>" onclick="return cekHapus('<?php 
		echo $rs['judul'];?>');"><i class="fa fa-trash-o"></i> Delete</a>
        
      </td>
	</tr>
	<?php $no++?>
	<?php endwhile;?>
</table>
</div><br/><br/><br/><br/>
<a href="?q=11" class="btn btn-danger">
	Tambah Agenda
</a> 
<script language="JavaScript">
function cekHapus(nama){
	if(confirm("Yakin akan menghapus agenda : \""+ nama +" ? \"")){
		return true;
	} else {
		return false;
	}
}
</script>
